﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Forum
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            // Users/List
            routes.MapRoute(
              name: "Users List",
              url: "Users/List",
              defaults: new
              {
                  controller = "Users",
                  action = "List",
                  username = UrlParameter.Optional,
              }
          );
            // Users/CreateForm
            routes.MapRoute(
              name: "Users Create Form",
              url: "Users/CreateForm",
              defaults: new
              {
                  controller = "Users",
                  action = "CreateForm",
                  username = UrlParameter.Optional,
              }
          ); 
          
            // Users/CreateUser
            routes.MapRoute(
              name: "Users Create",
              url: "Users/CreateUser",
              defaults: new
              {
                  controller = "Users",
                  action = "CreateUser",
                  username = UrlParameter.Optional,
              }
          );
            //ForumPost/Questions
            routes.MapRoute(
                 name: "Forum post",
                 url: "Questions/{postId}/{*catchAll}",
                 defaults: new
                 {
                     controller = "ForumPosts",
                     action = "ViewPost",
                 }
                 );

            // Users/Maya
            routes.MapRoute(
              name: "Users",
              url: "Users/{username}",
              defaults: new
              {
                  controller = "Users",
                  action = "ByUsername",
                  username = UrlParameter.Optional,
              }
          );
           
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { 
                    controller = "Home", 
                    action = "Index", 
                    id = UrlParameter.Optional }
            );
           

           


        }
    }
}